From 23909dd626995f91f8ce4c438b373a0d0e0c5408 Mon Sep 17 00:00:00 2001 From: "rac61@labyrinth.cl.cam.ac.uk" Date: Mon, 7 Jul 2003 09:51:04 +0000 Subject: [PATCH] bitkeeper revision 1.283 (3f094288pNoSBSaFk_QayYrITerstw) Add support for imaginary/virtual/whatever you want to call them partition tables used by raw disks Change diskno data type back, changing it was a silly idea. --- .../org/xenoserver/cmdline/ParsePhysicalGrant.java | 3 ++- .../org/xenoserver/control/CommandPhysicalGrant.java | 11 ++++++++--- .../org/xenoserver/control/CommandPhysicalRevoke.java | 2 +- tools/control/src/org/xenoserver/control/Extent.java | 4 ++-- .../control/src/org/xenoserver/control/Partition.java | 7 +++---- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/tools/control/src/org/xenoserver/cmdline/ParsePhysicalGrant.java b/tools/control/src/org/xenoserver/cmdline/ParsePhysicalGrant.java index 6792a43e47..ba81983273 100644 --- a/tools/control/src/org/xenoserver/cmdline/ParsePhysicalGrant.java +++ b/tools/control/src/org/xenoserver/cmdline/ParsePhysicalGrant.java @@ -43,8 +43,9 @@ public class ParsePhysicalGrant extends CommandParser { // Convert the partition into a physical extent Extent e = p.toExtent(); + int partition_no = p.getMinor() & 0x1F; - String output = new CommandPhysicalGrant( d, domain_id, e, mode ).execute(); + String output = new CommandPhysicalGrant( d, domain_id, e, mode, partition_no ).execute(); if ( output != null ) System.out.println( output ); } diff --git a/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java b/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java index c7152e46c3..03323d75f6 100644 --- a/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java +++ b/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java @@ -5,6 +5,7 @@ public class CommandPhysicalGrant extends Command { private int domain_id; private Extent extent; private Mode mode; + private int partition_no; /** * Constructor for CommandPhysicalGrant. @@ -12,16 +13,19 @@ public class CommandPhysicalGrant extends Command { * @param domain_id Domain to grant access for. * @param extent Extent to grant access to. * @param mode Access mode to grant. + * @param partition_no Partition number to use (or zero for none). */ public CommandPhysicalGrant( Defaults d, int domain_id, Extent extent, - Mode mode) { + Mode mode, + int partition_no) { this.d = d; this.domain_id = domain_id; this.extent = extent; this.mode = mode; + this.partition_no = partition_no; } public String execute() throws CommandFailedException { @@ -30,7 +34,7 @@ public class CommandPhysicalGrant extends Command { try { Process start_p; - String start_cmdarray[] = new String[6]; + String start_cmdarray[] = new String[7]; int start_rc; start_cmdarray[0] = d.XIToolsDir + "xi_phys_grant"; if ( mode == Mode.READ_WRITE ) @@ -40,9 +44,10 @@ public class CommandPhysicalGrant extends Command { else throw new CommandFailedException( "Unknown access mode '" + mode + "'" ); start_cmdarray[2] = Integer.toString( domain_id ); - start_cmdarray[3] = Short.toString( extent.getDisk() ); + start_cmdarray[3] = Integer.toString( extent.getDisk() ); start_cmdarray[4] = Long.toString( extent.getOffset() ); start_cmdarray[5] = Long.toString( extent.getSize() ); + start_cmdarray[6] = Integer.toString( partition_no ); if (Settings.TEST) { output = reportCommand(start_cmdarray); diff --git a/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java b/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java index 63052b1d4b..290af9ffe3 100644 --- a/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java +++ b/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java @@ -30,7 +30,7 @@ public class CommandPhysicalRevoke extends Command { int start_rc; start_cmdarray[0] = d.XIToolsDir + "xi_phys_revoke"; start_cmdarray[1] = Integer.toString( domain_id ); - start_cmdarray[2] = Short.toString( extent.getDisk() ); + start_cmdarray[2] = Integer.toString( extent.getDisk() ); start_cmdarray[3] = Long.toString( extent.getOffset() ); start_cmdarray[4] = Long.toString( extent.getSize() ); diff --git a/tools/control/src/org/xenoserver/control/Extent.java b/tools/control/src/org/xenoserver/control/Extent.java index e4ccff6806..cd653a9ed9 100644 --- a/tools/control/src/org/xenoserver/control/Extent.java +++ b/tools/control/src/org/xenoserver/control/Extent.java @@ -8,11 +8,11 @@ package org.xenoserver.control; public class Extent { - short disk; + int disk; long offset; /* offset into disk */ long size; /* size of this extent in 512 byte sectors */ - public short + public int getDisk() { return disk; diff --git a/tools/control/src/org/xenoserver/control/Partition.java b/tools/control/src/org/xenoserver/control/Partition.java index 03237c5fb1..5ca9e02b3e 100644 --- a/tools/control/src/org/xenoserver/control/Partition.java +++ b/tools/control/src/org/xenoserver/control/Partition.java @@ -161,11 +161,10 @@ Partition { Extent e = new Extent(); // Build 16-bit disk number.. high 8 bits are the major - int disknum = major << 8; + e.disk = major << 8; // Low 8 bits are the minor, but bottom 5 need to be cleared // as they are the partition number, not the disk number - disknum |= ( minor & 0xE0 ); - e.disk = (short) disknum; + e.disk |= ( minor & 0xE0 ); e.offset = start_sect; e.size = nr_sects; return e; @@ -179,7 +178,7 @@ Partition { if ( e.getMajor() != major ) return false; - if ( e.getMinor() != (minor & 0xE0) ) + if ( e.getMinor() != minor ) return false; if ( e.offset != start_sect ) return false; -- 2.30.2